package com.niodata.dp.task.service;

import com.niodata.dp.task.PluginPackageStore;
import com.niodata.dp.task.entity.PluginPackage;
import java.io.IOException;
import java.util.List;

/**
 * job package manager,used for etl plugin package,customized package,built in file plugin. package
 * storage,package search.
 */
public interface PluginManager extends PluginPackageStore {

  public void savePackageInfo(PluginPackage jobPackage);

  public PluginPackage getPlugin(String name, String version);

  public PluginPackage getPlugin(String id);

  public List<PluginPackage> getUserAuthorizedPlugins(Long userId,
      String type,
      String nameContains,
      int count,
      int minSeq,
      boolean forward);

  public List<PluginPackage> getUserAuthorizedPlugins(Long userId,
      String type,
      String nameContains,
      int count,
      int offset);

  public List<PluginPackage> getUserAuthorizedPluginsByCategory(Long userId,
      String type,
      String sysCategory,
      String funcCategory,
      String nameContains,
      int count, int minSeq, boolean forward);

  /**
   * remove package.
   *
   * @param name package name
   * @param version package version
   */
  public void removePlugin(String name, String version) throws IOException;

  /**
   * remove package.
   *
   * @param pkgId pkgid
   */
  public void removePlugin(String pkgId) throws IOException;

  public List<PluginPackage> getAllPlugins();

  public List<PluginPackage> getPluginsByName(String name);

  public List<String> getPluginTypes();

  public List<String> getSysCategories();

  public List<String> getFuncCategories(String sysCategory);

  public void update(PluginPackage pluginPackage);


}
